home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume12 / cake / part09 < prev    next >
Encoding:
Internet Message Format  |  1987-10-15  |  23.1 KB

  1. Subject:  v12i015:  Cake, a make replacement, Part09/09
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rs@uunet.UU.NET
  5.  
  6. Submitted-by: Zoltan Somogyi <zs@munnari.oz>
  7. Posting-number: Volume 12, Issue 15
  8. Archive-name: cake/part09
  9.  
  10. #! /bin/sh
  11. # This is a shell archive, meaning:
  12. # 1. Remove everything above the #! /bin/sh line.
  13. # 2. Save the resulting text in a file.
  14. # 3. Execute the file with /bin/sh (not csh) to create:
  15. #    README
  16. #    ccs
  17. #    cs
  18. #    defn
  19. #    double
  20. #    extract
  21. #    fix
  22. #    gred
  23. #    grei
  24. #    gres
  25. #    irrel
  26. #    isoption
  27. #    mainfile
  28. #    nonnull
  29. #    ol
  30. #    rmv
  31. #    soincl
  32. #    ssize
  33. #    yygram
  34. #    yyrepl
  35. #    yystat
  36. # This archive created: Wed Oct 14 20:30:12 1987
  37. export PATH; PATH=/bin:/usr/bin:$PATH
  38. echo mkdir Script
  39. mkdir Script
  40. echo cd Script
  41. cd Script
  42. echo shar: "extracting 'README'" '(754 characters)'
  43. if test -f 'README'
  44. then
  45.     echo shar: "will not over-write existing file 'README'"
  46. else
  47. sed 's/^X//' << \SHAR_EOF > 'README'
  48. XThis directory contains those commands used by the "standard" cakefiles
  49. Xwhich are implemented by scripts.
  50. X
  51. XThe commands reporting on cake stats (cs and ccs) have embedded in them
  52. Xthe name of the cake stats file; if you change the macro STATS_FILE
  53. Xin ../conf.h, you should change these also (unless you turn off stats
  54. Xaltogether, of course). Apart from this, "fix" is the only program
  55. Xthat will require adjustments, at least on Berkeley systems.
  56. X
  57. XHowever, on systems without #!, you will need to do some work
  58. Xto replace #! /bin/sh lines with : lines and convert /bin/awk
  59. Xinterpreted scripts into Bourne shell scripts; on systems which don't
  60. Xeven recognize # as signifying a C-shell script, you will also need
  61. Xto convert C-shell scripts into Bourne shell.
  62. SHAR_EOF
  63. if test 754 -ne "`wc -c < 'README'`"
  64. then
  65.     echo shar: "error transmitting 'README'" '(should have been 754 characters)'
  66. fi
  67. fi
  68. echo shar: "extracting 'ccs'" '(538 characters)'
  69. if test -f 'ccs'
  70. then
  71.     echo shar: "will not over-write existing file 'ccs'"
  72. else
  73. sed 's/^X//' << \SHAR_EOF > 'ccs'
  74. X#! /bin/sh
  75. Xcat > /tmp/ccs$$ << END_PROG
  76. X    {
  77. X        if (NF == 10)
  78. X        {
  79. X            otried += \$7;
  80. X            ofound += \$8;
  81. X            stried += \$9;
  82. X            sfound += \$10;
  83. X        }
  84. X    }
  85. XEND    {
  86. X        printf "output cache accesses:  %8d\n", otried;
  87. X        printf "output cache hits:      %8d\n", ofound;
  88. X        printf "output cache hit ratio: %8.2f\n", (ofound*100)/otried;
  89. X        printf "status cache accesses:  %8d\n", stried;
  90. X        printf "status cache hits:      %8d\n", sfound;
  91. X        printf "status cache hit ratio: %8.2f\n", (sfound*100)/stried;
  92. X    }
  93. XEND_PROG
  94. Xawk -f /tmp/ccs$$ < /u/pgrad/zs/lib/cake_stats
  95. SHAR_EOF
  96. if test 538 -ne "`wc -c < 'ccs'`"
  97. then
  98.     echo shar: "error transmitting 'ccs'" '(should have been 538 characters)'
  99. fi
  100. chmod +x 'ccs'
  101. fi
  102. echo shar: "extracting 'cs'" '(1432 characters)'
  103. if test -f 'cs'
  104. then
  105.     echo shar: "will not over-write existing file 'cs'"
  106. else
  107. sed 's/^X//' << \SHAR_EOF > 'cs'
  108. X#! /bin/sh
  109. Xcat > /tmp/cs.prog$$ << END_PROG
  110. XBEGIN    {
  111. X        printf "%8s%5s%8s", "", "", "";
  112. X        printf "%8s%8s%8s%8s", "self", "self", "child", "child";
  113. X        printf "%8s%10s%8s", "", "", "o/h";
  114. X        printf "\n";
  115. X        printf "%-8s%5s%8s", "user", "inv", "mem";
  116. X        printf "%8s%8s%8s%8s", "usr", "sys", "usr", "sys";
  117. X        printf "%8s%10s%8s", "all", "total", "ratio";
  118. X        printf "\n\n";
  119. X    }
  120. X    {
  121. X        inv[\$1] += 1;        inv["total"] += 1;
  122. X        su[\$1]  += \$2;    su["total"]  += \$2;
  123. X        ss[\$1]  += \$3;    ss["total"]  += \$3;
  124. X        cu[\$1]  += \$4;    cu["total"]  += \$4;
  125. X        cs[\$1]  += \$5;    cs["total"]  += \$5;
  126. X        mem[\$1] += \$6;    mem["total"] += \$6;
  127. X    }
  128. XEND    {
  129. X        for (u in inv)
  130. X        {
  131. X            opt   = (su[u])/100;
  132. X            unopt = (ss[u] + cu[u] + cs[u])/100;
  133. X            all   = (su[u] + ss[u] + cu[u] + cs[u])/100;
  134. X
  135. X            printf "%-8s%5d", u, inv[u]        > "/tmp/cs.out$$";
  136. X            printf "%7dk", mem[u]/(1000*inv[u])    > "/tmp/cs.out$$";
  137. X            printf "%8.2f", su[u]/(100*inv[u])    > "/tmp/cs.out$$";
  138. X            printf "%8.2f", ss[u]/(100*inv[u])    > "/tmp/cs.out$$";
  139. X            printf "%8.2f", cu[u]/(100*inv[u])    > "/tmp/cs.out$$";
  140. X            printf "%8.2f", cs[u]/(100*inv[u])    > "/tmp/cs.out$$";
  141. X            printf "%8.2f%10.2f", all/inv[u], all    > "/tmp/cs.out$$";
  142. X            if (opt > 0)
  143. X                printf "%8.2f", unopt/opt    > "/tmp/cs.out$$";
  144. X            else
  145. X                printf "%s", "infinity"        > "/tmp/cs.out$$";
  146. X            printf "\n"                > "/tmp/cs.out$$";
  147. X        }
  148. X    }
  149. XEND_PROG
  150. Xawk -f /tmp/cs.prog$$ < /u/pgrad/zs/lib/cake_stats
  151. Xsort +8n /tmp/cs.out$$
  152. X/bin/rm -f /tmp/cs.prog$$ /tmp/cs.out$$
  153. SHAR_EOF
  154. if test 1432 -ne "`wc -c < 'cs'`"
  155. then
  156.     echo shar: "error transmitting 'cs'" '(should have been 1432 characters)'
  157. fi
  158. chmod +x 'cs'
  159. fi
  160. echo shar: "extracting 'defn'" '(515 characters)'
  161. if test -f 'defn'
  162. then
  163.     echo shar: "will not over-write existing file 'defn'"
  164. else
  165. sed 's/^X//' << \SHAR_EOF > 'defn'
  166. Xgrep -n "^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]" $* > /tmp/$$
  167. Xed - /tmp/$$ <<'EOF'
  168. Xg/extern/d
  169. Xg/^\(.*:\).*[     ]\**\([^     ][^     ]*(.*)\).*$/s//\1\2/
  170. Xv/(.*)/d
  171. Xg/[-;\*\[\]%!<>=]/d
  172. Xg/,.*(/d
  173. Xg/:.*:.*:/d
  174. Xg/    /s// /g
  175. Xg/:$/d
  176. Xg/^\(.*(.*)\).*/s//\1/
  177. Xg/^\(.*:.............................................\).*/s//\1/
  178. X1,$s/\(.*:\)\(.*\)/\2|\1/
  179. Xg/^[^a-zA-Z_]/d
  180. X1,$s/|/                                                 /
  181. X1,$s/^\(................................................\) */\1/
  182. Xw
  183. Xq
  184. XEOF
  185. Xcat /tmp/$$
  186. Xrm /tmp/$$
  187. SHAR_EOF
  188. if test 515 -ne "`wc -c < 'defn'`"
  189. then
  190.     echo shar: "error transmitting 'defn'" '(should have been 515 characters)'
  191. fi
  192. chmod +x 'defn'
  193. fi
  194. echo shar: "extracting 'double'" '(424 characters)'
  195. if test -f 'double'
  196. then
  197.     echo shar: "will not over-write existing file 'double'"
  198. else
  199. sed 's/^X//' << \SHAR_EOF > 'double'
  200. X#! /bin/csh -f
  201. Xforeach file ($*)
  202. Xcat > /tmp/double$$ << ENDPROG
  203. XBEGIN    {
  204. X        lastword = "";
  205. X        lastfile = "";
  206. X    }
  207. X    {
  208. X    }
  209. XNF > 0    {
  210. X        if (\$1 == lastword)
  211. X            printf "file %s, line %d: double %s\n", "$file", NR, \$1;
  212. X
  213. X        for (i = 2; i <= NF; i++)
  214. X            if (\$i == \$(i-1))
  215. X                printf "file %s, line %d: double %s\n", "$file", NR, \$i;
  216. X
  217. X        lastword = \$NF;
  218. X    }
  219. XENDPROG
  220. Xtr A-Z a-z < $file | awk -f /tmp/double$$
  221. Xend
  222. X/bin/rm -f /tmp/double$$
  223. SHAR_EOF
  224. if test 424 -ne "`wc -c < 'double'`"
  225. then
  226.     echo shar: "error transmitting 'double'" '(should have been 424 characters)'
  227. fi
  228. chmod +x 'double'
  229. fi
  230. echo shar: "extracting 'extract'" '(315 characters)'
  231. if test -f 'extract'
  232. then
  233.     echo shar: "will not over-write existing file 'extract'"
  234. else
  235. sed 's/^X//' << \SHAR_EOF > 'extract'
  236. X#! /bin/sh
  237. Xcase $# in
  238. X    2) file=$1; suff=$2; conf=Conf;;
  239. X    3) file=$1; suff=$2; conf=$3;;
  240. X    *) echo "Usage: $0 mainfile suffix [Conf]"; exit 1;;
  241. Xesac
  242. Xcat > /tmp/extract$$ << END_PROG
  243. X/^$file/{
  244. X        for (i = 2; i <= NF; i++)
  245. X            printf "%s%s\n", \$i, "$suff";
  246. X    }
  247. XEND_PROG
  248. Xawk -f /tmp/extract$$ $conf
  249. X/bin/rm /tmp/extract$$
  250. SHAR_EOF
  251. if test 315 -ne "`wc -c < 'extract'`"
  252. then
  253.     echo shar: "error transmitting 'extract'" '(should have been 315 characters)'
  254. fi
  255. chmod +x 'extract'
  256. fi
  257. echo shar: "extracting 'fix'" '(5686 characters)'
  258. if test -f 'fix'
  259. then
  260.     echo shar: "will not over-write existing file 'fix'"
  261. else
  262. sed 's/^X//' << \SHAR_EOF > 'fix'
  263. X#! /bin/sh
  264. X# fix    Ver. 2.0, 20/1/86
  265. X# interactive spelling checker and fixer
  266. X#   Rex Sanders, USGS Pacific Marine Geology
  267. X#   Modifications by Bill Silvert, MEL
  268. X#   Modifications by Ed Reeder, Intel
  269. X#   Rewritten by Bill Ross and Zoltan Somogyi, University of Melbourne
  270. X#
  271. X# usage:
  272. X#     fix [-d dict] [-l local] [-p pnouns] [-s] [-a] [-b] [-o out] [-i in] files
  273. X#        -d use dict as your private dictionary
  274. X#            this is the only dictionary that gets uppercase
  275. X#            folded to lower (default $HOME/lib/dict/words)
  276. X#            the directory $HOME/lib/dict MUST exist
  277. X#        -p use pnouns as the dictionary of proper nouns
  278. X#                    (default=$HOME/lib/dict/proper-nouns)
  279. X#        -l use local as the dictionary specific to this paper
  280. X#                    (default=./.words)
  281. X#        -a use american spelling
  282. X#        -b use british spelling (default)
  283. X#        -s don't assume the dictionaries are sorted
  284. X#           by default we assume dict, local and pnouns
  285. X#           are all sorted, and dict is all lower case,
  286. X#           because sorting takes time.
  287. X#        -o write the mistakes to a file, and exit
  288. X#        -i read mistakes in from a file instead of running spell
  289. X#
  290. X# to come:
  291. X#        preservation of case for beginning of sentence
  292. X#        allow >1 word to be typed for a correction
  293. X#            (at the moment it creates a file of the name of
  294. X#             the second word---weird!)
  295. X# bugs:
  296. X#        painfully slow on substitutions
  297. X
  298. Xmis=/tmp/spf$$.mis
  299. Xsub=/tmp/spf$$.sub
  300. Xmrk=/tmp/spf$$.mrk
  301. Xtmp=/tmp/spf$$.tmp
  302. XFILES=
  303. XSORTED=
  304. XSPELLOPT="-b"
  305. XOUTFILE=
  306. XINFILE=
  307. XWORDS=$HOME/lib/dict/words
  308. XPNOUNS=$HOME/lib/dict/proper-nouns
  309. XLWORDS=./.words
  310. XSPELLEDITOR=${SPELLEDITOR-'vi +/###/'}
  311. XWJRBIN=/u/hons/wjr/bin
  312. X
  313. Xtrap "/bin/rm -f $mis $tmp $sub $mrk ; exit" 0 1 2 15
  314. X
  315. Xwhile test -n "$1"
  316. Xdo
  317. X    case $1 in
  318. X    -d)    shift
  319. X        WORDS=$1
  320. X        ;;
  321. X    -l)    shift
  322. X        LWORDS=$1
  323. X        ;;
  324. X    -p)    shift
  325. X        PNOUNS=$1
  326. X        ;;
  327. X    -a)    SPELLOPT=
  328. X        ;;
  329. X    -b)    SPELLOPT="-b"
  330. X        ;;
  331. X    -s)    SORTED="n"
  332. X        ;;
  333. X    -i)    shift
  334. X        INFILE=$1
  335. X        ;;
  336. X    -o)    shift
  337. X        OUTFILE=$1
  338. X        ;;
  339. X    *)    FILES="$FILES $1"
  340. X        ;;
  341. X    esac
  342. X    shift
  343. Xdone
  344. X
  345. Xif test -n "$INFILE"
  346. Xthen
  347. X    echo "Reading mistakes from $INFILE for corrections to $FILES"
  348. X    cp $INFILE $mis
  349. Xelse
  350. X    echo "Looking for spelling errors in $FILES ..."
  351. X
  352. X    touch $LWORDS        # we remove this at the end if it wasn't used
  353. X
  354. X    if test "$SORTED"
  355. X    then
  356. X        # -s option - force a sort of the dictionaries
  357. X        if test ! -s $WORDS
  358. X        then
  359. X            touch $WORDS
  360. X        else
  361. X            tr A-Z a-z < $WORDS > $tmp
  362. X            sort -u -f $tmp -o $WORDS
  363. X        fi
  364. X
  365. X        if test ! -s $LWORDS
  366. X        then
  367. X            touch $LWORDS
  368. X        else
  369. X            sort -u  $LWORDS -o $LWORDS
  370. X        fi
  371. X
  372. X        if test ! -s $PNOUNS
  373. X        then
  374. X            touch $PNOUNS
  375. X        else
  376. X            sort -u  $PNOUNS -o $PNOUNS
  377. X        fi
  378. X    fi
  379. X
  380. X    # ignore numbers, but keep alpha-numerics
  381. X    /usr/bin/spell -b $FILES | egrep -v '^[0-9]+$' > $tmp
  382. X    # remove the possessive apostrophe
  383. X    if egrep \'s\$ $tmp > /dev/null
  384. X    then
  385. X        $WJRBIN/gres \'s\$ "" $tmp
  386. X    fi
  387. X    
  388. X    sort -u $tmp -o $mis    # must be sorted for comm
  389. X
  390. X    # remove the words we know about
  391. X    comm -23 $mis $PNOUNS | comm -23 - $LWORDS | comm -23 - $WORDS > $tmp
  392. X    # now get rid of words in with (some) upper case that appear in words
  393. X    egrep -v [A-Z] $tmp > $mis
  394. X    for word in `egrep [A-Z] $tmp`
  395. X    do
  396. X        if grep -i -w $word $WORDS > /dev/null
  397. X        then
  398. X            echo -n    # a nop ! (continue does the wrong thing)
  399. X        else
  400. X            echo $word >> $mis
  401. X        fi
  402. X    done
  403. X    sort -u $mis -o $mis
  404. Xfi
  405. X
  406. Xif test ! -s $mis
  407. Xthen
  408. X    echo "No spelling errors found in $FILES"
  409. X    /bin/rm -f $mis $sub $mrk $tmp
  410. X    if test ! -s $LWORDS
  411. X    then
  412. X        /bin/rm -f $LWORDS
  413. X    fi
  414. X    exit 0
  415. Xfi
  416. X
  417. Xif test -n "$OUTFILE"
  418. Xthen
  419. X    mv $mis $OUTFILE
  420. X    /bin/rm -f $mis $sub $mrk $tmp
  421. X    if test ! -s $LWORDS
  422. X    then
  423. X        /bin/rm -f $LWORDS
  424. X    fi
  425. X    exit 0
  426. Xfi
  427. X
  428. Xecho "Found `/usr/ucb/wc -l < $mis` misspellings"
  429. Xecho "Responses:"
  430. Xecho "g=add to user (global) dictionary"
  431. Xecho "p=add to user (global) dictionary of proper-nouns"
  432. Xecho "l=add to user (local) dictionary"
  433. Xecho "f=use a regular expression to look for correct spelling"
  434. Xecho "m=mark for correction, b=bypass"
  435. Xecho "Anything else is the correction"
  436. X
  437. Xfor word in `cat $mis`
  438. Xdo
  439. X    egrep $word $FILES
  440. X    while true
  441. X    do
  442. X        echo -n "${word}: [correction or bglpfm] "
  443. X        read response
  444. X        case $response in
  445. X        G|g)
  446. X            echo $word >> $WORDS
  447. X            ##echo adding $word to global dictionary
  448. X            addedg=y
  449. X            break 
  450. X            ;;
  451. X        P|p)
  452. X            echo $word >> $PNOUNS
  453. X            ##echo adding $word to proper-noun dictionary
  454. X            addedp=y
  455. X            break 
  456. X            ;;
  457. X        L|l)
  458. X            echo $word >> $LWORDS
  459. X            ##echo adding $word to local dictionary
  460. X            addedl=y
  461. X            break 
  462. X            ;;
  463. X        ""|B|b)
  464. X            ##echo bypass on $word
  465. X            break
  466. X            ;;
  467. X        F|f)
  468. X            echo -n "Search pattern for word: "
  469. X            read response
  470. X            if test "$response"
  471. X            then
  472. X                cat $PNOUNS $LWORDS $WORDS | egrep "$response" > $tmp
  473. X                egrep "$response" /usr/dict/words | sort -f - $tmp | more
  474. X            fi
  475. X            ;;
  476. X        M|m)
  477. X            echo "$WJRBIN/grei \"\\<${word}\\>\" \"### spell: ${word} %%%\" $FILES" >> $mrk
  478. X            ##echo marking $word
  479. X            break
  480. X            ;;
  481. X        *)    
  482. X            echo "$WJRBIN/gres \"\\<${word}\\>\" ${response} $FILES" >> $sub
  483. X            ##echo changing $word to $response
  484. X            break
  485. X            ;;
  486. X        esac
  487. X    done
  488. Xdone
  489. X
  490. Xif test ${addedg-n} = y
  491. Xthen
  492. X    tr A-Z a-z < $WORDS > $tmp
  493. X    sort -u -f $tmp -o $WORDS
  494. Xfi
  495. Xif test ${addedl-n} = y
  496. Xthen
  497. X    sort -u $LWORDS -o $LWORDS
  498. Xelif test ! -s $LWORDS
  499. Xthen
  500. X    /bin/rm -f $LWORDS
  501. Xfi
  502. Xif test ${addedp-n} = y
  503. Xthen
  504. X    sort -u $PNOUNS -o $PNOUNS
  505. Xfi
  506. X
  507. Xif test ! -s $sub -a ! -s $mrk
  508. Xthen
  509. X    /bin/rm -f $mis $sub $mrk $tmp
  510. X    exit 0
  511. Xfi
  512. X
  513. Xwhile true
  514. Xdo
  515. X    echo -n "Do you want to overwrite $FILES [yn] "
  516. X    read reply
  517. X    case "$reply" in
  518. X    y*|Y*)
  519. X        break
  520. X        ;;
  521. X    n*|N*)
  522. X        /bin/rm -f $mis $sub $mrk $tmp
  523. X        exit 0
  524. X        ;;
  525. X    *)
  526. X        continue
  527. X        ;;
  528. X    esac
  529. Xdone
  530. X
  531. Xif test -s $sub
  532. Xthen
  533. X    echo -n "Substituting.... "
  534. X    . $sub
  535. X    echo "done."
  536. Xfi
  537. X
  538. Xif test -s $mrk
  539. Xthen
  540. X    echo -n "Marking.... "
  541. X    . $mrk
  542. X    echo "done."
  543. X    mod=""
  544. X    for file in $FILES
  545. X    do
  546. X        if fgrep '###' $file > /dev/null
  547. X        then
  548. X            mod="$mod $file"
  549. X        fi
  550. X    done
  551. X    $SPELLEDITOR $mod
  552. Xfi
  553. X
  554. X/bin/rm -f $mis $sub $mrk $tmp
  555. SHAR_EOF
  556. if test 5686 -ne "`wc -c < 'fix'`"
  557. then
  558.     echo shar: "error transmitting 'fix'" '(should have been 5686 characters)'
  559. fi
  560. chmod +x 'fix'
  561. fi
  562. echo shar: "extracting 'gred'" '(309 characters)'
  563. if test -f 'gred'
  564. then
  565.     echo shar: "will not over-write existing file 'gred'"
  566. else
  567. sed 's/^X//' << \SHAR_EOF > 'gred'
  568. X#! /bin/sh
  569. X# gred - delete regular expression
  570. X# usage: gred pattern file ...
  571. X
  572. Xcase $# in
  573. X    0|1) echo 1>&2 Usage: gred pattern file ...; exit 1;;
  574. Xesac
  575. XTERMCAP=/etc/termcap; export TERMCAP
  576. Xpattern=$1
  577. Xshift
  578. Xfor file in $*
  579. Xdo
  580. X    ex - $file << END ; : use ex so that \< \> can be used
  581. X    g/${pattern}/d
  582. X    w!
  583. X    q
  584. XEND
  585. Xdone
  586. SHAR_EOF
  587. if test 309 -ne "`wc -c < 'gred'`"
  588. then
  589.     echo shar: "error transmitting 'gred'" '(should have been 309 characters)'
  590. fi
  591. chmod +x 'gred'
  592. fi
  593. echo shar: "extracting 'grei'" '(341 characters)'
  594. if test -f 'grei'
  595. then
  596.     echo shar: "will not over-write existing file 'grei'"
  597. else
  598. sed 's/^X//' << \SHAR_EOF > 'grei'
  599. X#! /bin/sh
  600. X# grei - insert at regular expressions
  601. X# usage: grei where what file ...
  602. X
  603. Xcase $# in
  604. X    0|1|2) echo 1>&2 Usage: grei where what file ...; exit 1;;
  605. Xesac
  606. XTERMCAP=/etc/termcap; export TERMCAP
  607. Xwhere=$1
  608. Xwhat=$2
  609. Xshift; shift
  610. Xfor file in $*
  611. Xdo
  612. X    ex - $file << END ; : use ex so that \< \> can be used
  613. X    g/${where}/i\\
  614. X${what}
  615. X    w
  616. X    q
  617. XEND
  618. Xdone
  619. SHAR_EOF
  620. if test 341 -ne "`wc -c < 'grei'`"
  621. then
  622.     echo shar: "error transmitting 'grei'" '(should have been 341 characters)'
  623. fi
  624. chmod +x 'grei'
  625. fi
  626. echo shar: "extracting 'gres'" '(338 characters)'
  627. if test -f 'gres'
  628. then
  629.     echo shar: "will not over-write existing file 'gres'"
  630. else
  631. sed 's/^X//' << \SHAR_EOF > 'gres'
  632. X#! /bin/sh
  633. X# gres - substitute regular expressions
  634. X# usage: gres from to file ...
  635. X
  636. Xcase $# in
  637. X    0|1|2) echo 1>&2 Usage: gres from to file ...; exit 1;;
  638. Xesac
  639. XTERMCAP=/etc/termcap; export TERMCAP
  640. Xfrom=$1
  641. Xto=$2
  642. Xshift; shift
  643. Xfor file in $*
  644. Xdo
  645. X    ex - $file << END ; : use ex so that \< \> can be used
  646. X    g/${from}/s/${from}/${to}/g
  647. X    w
  648. X    q
  649. XEND
  650. Xdone
  651. SHAR_EOF
  652. if test 338 -ne "`wc -c < 'gres'`"
  653. then
  654.     echo shar: "error transmitting 'gres'" '(should have been 338 characters)'
  655. fi
  656. chmod +x 'gres'
  657. fi
  658. echo shar: "extracting 'irrel'" '(197 characters)'
  659. if test -f 'irrel'
  660. then
  661.     echo shar: "will not over-write existing file 'irrel'"
  662. else
  663. sed 's/^X//' << \SHAR_EOF > 'irrel'
  664. X#! /bin/sh
  665. X# irrel - delete irrelevant error messages
  666. X# usage: ... |& irrel pattern ...
  667. X
  668. Xcat - > /tmp/irrel$$
  669. Xfor pat in $*
  670. Xdo
  671. X    gred $pat /tmp/irrel$$
  672. Xdone
  673. Xcat /tmp/irrel$$
  674. X/bin/rm -f /tmp/irrel$$
  675. SHAR_EOF
  676. if test 197 -ne "`wc -c < 'irrel'`"
  677. then
  678.     echo shar: "error transmitting 'irrel'" '(should have been 197 characters)'
  679. fi
  680. chmod +x 'irrel'
  681. fi
  682. echo shar: "extracting 'isoption'" '(46 characters)'
  683. if test -f 'isoption'
  684. then
  685.     echo shar: "will not over-write existing file 'isoption'"
  686. else
  687. sed 's/^X//' << \SHAR_EOF > 'isoption'
  688. X#! /bin/csh
  689. Xsub \\-X option "$1" >& /dev/null
  690. SHAR_EOF
  691. if test 46 -ne "`wc -c < 'isoption'`"
  692. then
  693.     echo shar: "error transmitting 'isoption'" '(should have been 46 characters)'
  694. fi
  695. chmod +x 'isoption'
  696. fi
  697. echo shar: "extracting 'mainfile'" '(172 characters)'
  698. if test -f 'mainfile'
  699. then
  700.     echo shar: "will not over-write existing file 'mainfile'"
  701. else
  702. sed 's/^X//' << \SHAR_EOF > 'mainfile'
  703. X#! /bin/sh
  704. Xcase $# in
  705. X    1) suff=$1; conf=Conf;;
  706. X    2) suff=$1; conf=$2;;
  707. X    *) echo "Usage: $0 suffix [Conf]"; exit 1;;
  708. Xesac
  709. Xawk "{ printf \"%s%s\\n\", \$1, \"$suff\"; }" $conf
  710. SHAR_EOF
  711. if test 172 -ne "`wc -c < 'mainfile'`"
  712. then
  713.     echo shar: "error transmitting 'mainfile'" '(should have been 172 characters)'
  714. fi
  715. chmod +x 'mainfile'
  716. fi
  717. echo shar: "extracting 'nonnull'" '(53 characters)'
  718. if test -f 'nonnull'
  719. then
  720.     echo shar: "will not over-write existing file 'nonnull'"
  721. else
  722. sed 's/^X//' << \SHAR_EOF > 'nonnull'
  723. X#! /bin/sh
  724. Xcase $# in
  725. X    0) exit 1;;
  726. X    *) exit 0;;
  727. Xesac
  728. SHAR_EOF
  729. if test 53 -ne "`wc -c < 'nonnull'`"
  730. then
  731.     echo shar: "error transmitting 'nonnull'" '(should have been 53 characters)'
  732. fi
  733. chmod +x 'nonnull'
  734. fi
  735. echo shar: "extracting 'ol'" '(3070 characters)'
  736. if test -f 'ol'
  737. then
  738.     echo shar: "will not over-write existing file 'ol'"
  739. else
  740. sed 's/^X//' << \SHAR_EOF > 'ol'
  741. X#! /bin/awk -f
  742. XBEGIN        {
  743. X            for (i = 1; i <= 6; i++)
  744. X            {
  745. X                sect_no[i] = 0;
  746. X                sect_line[i] = 0;
  747. X                sect_start[i] = 0;
  748. X            }
  749. X
  750. X            curr_ind = "";
  751. X            sect_ind = "    "
  752. X            theo_ind = "    "
  753. X            offset = "            ";
  754. X            lineno = 0;
  755. X        }
  756. X/^\.sh/        {
  757. X            for (i = $2; i <= 6; i++)
  758. X            {
  759. X                if (sect_line[i] != 0)
  760. X                {
  761. X                    line[sect_line[i]] = sprintf(line[sect_line[i]], NR-sect_start[i]);
  762. X                }
  763. X            }
  764. X
  765. X            ++sect_no[$2];
  766. X            sect_line[$2] = lineno+1;
  767. X            sect_start[$2] = NR;
  768. X
  769. X            for (i = $2+1; i <= 6; i++)
  770. X            {
  771. X                sect_no[i] = 0;
  772. X                sect_line[i] = 0;
  773. X                sect_start[i] = 0;
  774. X            }
  775. X
  776. X            curr_ind = "";
  777. X            for (i = 2; i <= $2; i++)
  778. X                curr_ind = curr_ind sect_ind;
  779. X
  780. X            if ($2 == 1)
  781. X                theo_num = 0;
  782. X
  783. X            line[++lineno] = sprintf("%4d: %s(%%3d) section ", NR, curr_ind);
  784. X            pre = "";
  785. X            for (i = 1; i <= $2; i++)
  786. X            {
  787. X                line[lineno] = line[lineno] sprintf("%s%d", pre, sect_no[i]);
  788. X                pre = ".";
  789. X            }
  790. X
  791. X            line[lineno] = line[lineno] offset;
  792. X            pre = "";
  793. X            for (i = 3; i <= NF; i++)
  794. X            {
  795. X                line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
  796. X                pre = " ";
  797. X            }
  798. X
  799. X            line[lineno] = line[lineno] "\n";
  800. X        }
  801. X/^\.uh/        {
  802. X            line[++lineno] = sprintf("%4d:      %s section ", NR, curr_ind);
  803. X            line[lineno] = line[lineno] offset;
  804. X            pre = "";
  805. X            for (i = 2; i <= NF; i++)
  806. X            {
  807. X                line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
  808. X                pre = " ";
  809. X            }
  810. X
  811. X            line[lineno] = line[lineno] "\n";
  812. X        }
  813. X/^\.tr/        {
  814. X            line[++lineno] = sprintf("%4d:      %s%s theorem ", NR, curr_ind, theo_ind);
  815. X            line[lineno] = line[lineno] sprintf("%d.%d ", sect_no[1], ++theo_num);
  816. X            line[lineno] = line[lineno] offset;
  817. X            pre = "";
  818. X            for (i = 2; i <= NF; i++)
  819. X            {
  820. X                line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
  821. X                pre = " ";
  822. X            }
  823. X
  824. X            line[lineno] = line[lineno] "\n";
  825. X        }
  826. X/^\.le/        {
  827. X            line[++lineno] = sprintf("%4d:      %s%s lemma ", NR, curr_ind, theo_ind);
  828. X            line[lineno] = line[lineno] sprintf("%d.%d ", sect_no[1], ++theo_num);
  829. X            line[lineno] = line[lineno] offset;
  830. X
  831. X            pre = "";
  832. X            for (i = 2; i <= NF; i++)
  833. X            {
  834. X                line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
  835. X                pre = " ";
  836. X            }
  837. X
  838. X            line[lineno] = line[lineno] "\n";
  839. X        }
  840. X/^\.co/        {
  841. X            line[++lineno] = sprintf("%4d:      %s%s corollary ", NR, curr_ind, theo_ind);
  842. X            line[lineno] = line[lineno] sprintf("%d.%d ", sect_no[1], ++theo_num);
  843. X            line[lineno] = line[lineno] offset;
  844. X
  845. X            pre = "";
  846. X            for (i = 2; i <= NF; i++)
  847. X            {
  848. X                line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
  849. X                pre = " ";
  850. X            }
  851. X
  852. X            line[lineno] = line[lineno] "\n";
  853. X        }
  854. X/^\.dt/        {
  855. X            line[++lineno] = sprintf("%4d:      %s%s definition ", NR, curr_ind, theo_ind);
  856. X            line[lineno] = line[lineno] offset;
  857. X
  858. X            pre = "";
  859. X            for (i = 2; i <= NF; i++)
  860. X            {
  861. X                line[lineno] = line[lineno] sprintf("%s%s", pre, $i);
  862. X                pre = " ";
  863. X            }
  864. X
  865. X            line[lineno] = line[lineno] "\n";
  866. X        }
  867. XEND        {
  868. X            line[++lineno] = sprintf("%4d:       END\n", NR);
  869. X
  870. X            for (i = 1; i <= 6; i++)
  871. X            {
  872. X                if (sect_line[i] != 0)
  873. X                {
  874. X                    line[sect_line[i]] = sprintf(line[sect_line[i]], NR-sect_start[i]);
  875. X                }
  876. X            }
  877. X
  878. X            for (i = 1; i <= lineno; i++)
  879. X                printf "%s", line[i];
  880. X        }
  881. SHAR_EOF
  882. if test 3070 -ne "`wc -c < 'ol'`"
  883. then
  884.     echo shar: "error transmitting 'ol'" '(should have been 3070 characters)'
  885. fi
  886. chmod +x 'ol'
  887. fi
  888. echo shar: "extracting 'rmv'" '(22 characters)'
  889. if test -f 'rmv'
  890. then
  891.     echo shar: "will not over-write existing file 'rmv'"
  892. else
  893. sed 's/^X//' << \SHAR_EOF > 'rmv'
  894. X#! /bin/sh
  895. Xmv $* /tmp
  896. SHAR_EOF
  897. if test 22 -ne "`wc -c < 'rmv'`"
  898. then
  899.     echo shar: "error transmitting 'rmv'" '(should have been 22 characters)'
  900. fi
  901. chmod +x 'rmv'
  902. fi
  903. echo shar: "extracting 'soincl'" '(46 characters)'
  904. if test -f 'soincl'
  905. then
  906.     echo shar: "will not over-write existing file 'soincl'"
  907. else
  908. sed 's/^X//' << \SHAR_EOF > 'soincl'
  909. X#! /bin/csh -f
  910. Xawk '/^\.so/ { print $2; }' $*
  911. SHAR_EOF
  912. if test 46 -ne "`wc -c < 'soincl'`"
  913. then
  914.     echo shar: "error transmitting 'soincl'" '(should have been 46 characters)'
  915. fi
  916. chmod +x 'soincl'
  917. fi
  918. echo shar: "extracting 'ssize'" '(294 characters)'
  919. if test -f 'ssize'
  920. then
  921.     echo shar: "will not over-write existing file 'ssize'"
  922. else
  923. sed 's/^X//' << \SHAR_EOF > 'ssize'
  924. X: ssize - sort files by size, with wc info
  925. X: usage: sortsize file ...
  926. X
  927. XTERMCAP=/etc/termcap; export TERMCAP
  928. Xwc -v $* > /tmp/ssize1$$
  929. Xex - /tmp/ssize1$$ << END > /dev/null;
  930. X1,1w /tmp/ssize2$$
  931. X1d
  932. Xw
  933. Xq
  934. XEND
  935. X(cat /tmp/ssize2$$; sort -n +2 /tmp/ssize1$$) | more
  936. X/bin/rm -f /tmp/ssize1$$ /tmp/ssize2$$
  937. SHAR_EOF
  938. if test 294 -ne "`wc -c < 'ssize'`"
  939. then
  940.     echo shar: "error transmitting 'ssize'" '(should have been 294 characters)'
  941. fi
  942. chmod +x 'ssize'
  943. fi
  944. echo shar: "extracting 'yygram'" '(377 characters)'
  945. if test -f 'yygram'
  946. then
  947.     echo shar: "will not over-write existing file 'yygram'"
  948. else
  949. sed 's/^X//' << \SHAR_EOF > 'yygram'
  950. X#!/bin/awk -f
  951. X
  952. X# extract the grammar from a yacc file 
  953. X# usage yygram file ...
  954. X
  955. XBEGIN    {
  956. X        num = 0;
  957. X        braces = 0;
  958. X    }
  959. X/^%%$/    {
  960. X        braces++;
  961. X        next;
  962. X    }
  963. X/JUNK/    {    exit;        }
  964. XNF == 0    {    next;        }
  965. X/\t;/    {    next;        }
  966. X    {    
  967. X        if (index($0, "{") > 0)
  968. X            num++;
  969. X        if (num == 0 && braces == 1)
  970. X            print;
  971. X        if (index($0, "}") > 0)
  972. X            num--;
  973. X    }    
  974. XEND    {
  975. X        if (num != 0)
  976. X            print "Unmatched braces";
  977. X    }
  978. SHAR_EOF
  979. if test 377 -ne "`wc -c < 'yygram'`"
  980. then
  981.     echo shar: "error transmitting 'yygram'" '(should have been 377 characters)'
  982. fi
  983. chmod +x 'yygram'
  984. fi
  985. echo shar: "extracting 'yyrepl'" '(424 characters)'
  986. if test -f 'yyrepl'
  987. then
  988.     echo shar: "will not over-write existing file 'yyrepl'"
  989. else
  990. sed 's/^X//' << \SHAR_EOF > 'yyrepl'
  991. X#! /bin/csh -f
  992. Xcat > /tmp/yyrepl1$$ << END_PROG
  993. XBEGIN        {
  994. X            found = 0;
  995. X        }
  996. X/^YYREPL/    {
  997. X            if (NF < 3)
  998. X                next;
  999. X
  1000. X            found = 1;
  1001. X            printf "gres yy %s\n", \$2;
  1002. X            printf "gres YY %s\n", \$3;
  1003. X            exit;
  1004. X        }
  1005. XEND        {
  1006. X            if (found == 0)
  1007. X                printf "gres yy yy\n";
  1008. X        }
  1009. XEND_PROG
  1010. Xawk -f /tmp/yyrepl1$$ $1 > /tmp/yyrepl2$$
  1011. Xex - /tmp/yyrepl2$$ << END
  1012. X%s/\$/ $argv[2-]/g
  1013. Xw
  1014. Xq
  1015. XEND
  1016. Xsource /tmp/yyrepl2$$
  1017. X/bin/rm /tmp/yyrepl1$$ /tmp/yyrepl2$$
  1018. SHAR_EOF
  1019. if test 424 -ne "`wc -c < 'yyrepl'`"
  1020. then
  1021.     echo shar: "error transmitting 'yyrepl'" '(should have been 424 characters)'
  1022. fi
  1023. chmod +x 'yyrepl'
  1024. fi
  1025. echo shar: "extracting 'yystat'" '(35 characters)'
  1026. if test -f 'yystat'
  1027. then
  1028.     echo shar: "will not over-write existing file 'yystat'"
  1029. else
  1030. sed 's/^X//' << \SHAR_EOF > 'yystat'
  1031. X#! /bin/csh -f 
  1032. Xtail -13 $* | more
  1033. SHAR_EOF
  1034. if test 35 -ne "`wc -c < 'yystat'`"
  1035. then
  1036.     echo shar: "error transmitting 'yystat'" '(should have been 35 characters)'
  1037. fi
  1038. chmod +x 'yystat'
  1039. fi
  1040. exit 0
  1041. #    End of shell archive
  1042.